package day06;

public class MethodDemo {//方法的使用
    public static void main(String[] args) {

        int[] d = num(5,100);
        System.out.println("长度"+d.length);
        for (int i=0;i<d.length;i++){
            System.out.println(d[i]);
        }
        int[]e=num(3,50);
        for(int i =0;i<e.length;i++){
            System.out.println(e[i]);


        }
        say("zhangsan",25);
        say("lisi",66);


    }

    public static int[] num(int b,int max) {
        int[] arr = new int[b];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * max);
        }
        return arr;
    }
    public static void say(String name, int age) {
        if(age>60){//满足此条件，提前结束方法
            return;

        }
        System.out.println("大家好，我叫" + name + "，今年" + age + "岁了");
    }

}

      /*  say("鲸鲵", 24);

        int m=7,n=6;
        int c=pu(m,n);//传的是m，n里的数
        System.out.println(c);

    }

    }

    //在有返回值的方法中，必须通过return来返回数据
    public static double num() {
        return 8.88;
    }

    public static int pu(int num1, int num2) {
        int num = num1 + num2;//返回的是num里的那个数
        return num;

       */
